package com.klaus.ohMySpace.dao;

import com.klaus.ohMySpace.entity.BasicEntity;
import org.hibernate.Query;
import org.hibernate.criterion.DetachedCriteria;

import javax.persistence.MappedSuperclass;
import java.util.List;

/**
 * Created by Mklaus on 15/7/23.
 */
@MappedSuperclass
public interface BaseDao<T extends BasicEntity> {
    public Class classOfT();

    public T get(int id);

    public List<T> getAll();

    public void save(T t);

    public void update(T t);

    public void delete(int id);

    public void delete(T t);

    public int count(DetachedCriteria dc);

    public List<T> search(DetachedCriteria dc);

    public List<T> search(DetachedCriteria dc, Integer start, Integer size);

    public Query createQuery(String hql);
}
